﻿using System;
using System.Collections.Generic;
using System.Text;
using NPOI.SS.UserModel;

namespace Fin
{
	public	static class NpoiExt
	{
		public static string GetValue(  ICell cell)
		{
			try
			{
				cell.SetCellType(CellType.String);
				return cell.StringCellValue;

			}
			catch (Exception exx)
			{

				throw exx;
			}
		
		}
		public static List<List<string>> GetSheetDatas(ISheet sheet) {
			var re = new List<List<string>>();

			for (int i = 1; i <= sheet.LastRowNum; i++)
			{
				var row = sheet.GetRow(i);

                //for (int j=0;j<= sheet.GetColumnWidth();j++)
                //{

                //}

				if (row != null)
				{
					var listStr = new List<string>();

					foreach (var item in row.Cells)
					{
						item.SetCellType(CellType.String);

						listStr.Add(item.StringCellValue);

					}
					re.Add(listStr);
				}
                else
                {
                    int i1 = 0;
                }
				

			}
			 

			return re;
		}
	}
}
